From ed07a180a0781e49ac033ba59e4930abfa3747b3 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Thu, 23 May 2024 09:55:06 -0600 Subject: [PATCH] refactor interface to jeeps pvt related commands. (#1283) --- garmin.cc | 2 +- jeeps/gpsapp.cc | 19 +++++++++---------- jeeps/gpsapp.h | 4 ++-- jeeps/gpscom.cc | 11 +++++------ jeeps/gpscom.h | 4 ++-- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/garmin.cc b/garmin.cc index ce6fa3207..5c1b8c0ef 100644 --- a/garmin.cc +++ b/garmin.cc @@ -657,7 +657,7 @@ GarminFormat::rd_position(posn_status* posn_status) auto* wpt = new Waypoint; GPS_PPvt_Data pvt = GPS_Pvt_New(); - if (GPS_Command_Pvt_Get(&pvt_fd, &pvt)) { + if (GPS_Command_Pvt_Get(pvt_fd, &pvt)) { pvt2wpt(pvt, wpt); GPS_Pvt_Del(&pvt); diff --git a/jeeps/gpsapp.cc b/jeeps/gpsapp.cc index 43312fe37..5a091e874 100644 --- a/jeeps/gpsapp.cc +++ b/jeeps/gpsapp.cc @@ -361,7 +361,7 @@ static int32_t GPS_A000(const char* port) carry_on: /* Make sure PVT is off as some GPS' have it on by default */ if (gps_pvt_transfer != -1) { - GPS_A800_Off(port,&fd); + GPS_A800_Off(fd); } if (!GPS_Device_Off(fd)) { @@ -6126,12 +6126,11 @@ int32_t GPS_A800_On(const char* port, gpsdevh** fd) ** ** Turn off GPS PVT ** -** @param [r] port [const char *] port -** @param [w] fd [int32 *] file descriptor +** @param [r] fd [int32] file descriptor ** ** @return [int32] success ************************************************************************/ -int32_t GPS_A800_Off(const char* /*unused*/, gpsdevh** fd) +int32_t GPS_A800_Off(gpsdevh* fd) { static UC data[2]; GPS_Packet tra; @@ -6142,10 +6141,10 @@ int32_t GPS_A800_Off(const char* /*unused*/, gpsdevh** fd) COMMAND_ID[gps_device_command].Cmnd_Stop_Pvt_Data); GPS_Make_Packet(&tra, LINK_ID[gps_link_type].Pid_Command_Data, data,2); - if (!GPS_Write_Packet(*fd,tra)) { + if (!GPS_Write_Packet(fd,tra)) { return gps_errno; } - if (!GPS_Get_Ack(*fd, &tra, &rec)) { + if (!GPS_Get_Ack(fd, &tra, &rec)) { GPS_Error("A800_Off: Not acknowledged"); return FRAMING_ERROR; } @@ -6162,22 +6161,22 @@ int32_t GPS_A800_Off(const char* /*unused*/, gpsdevh** fd) ** ** make a position packet for sending to the GPS ** -** @param [r] fd [int32 *] file descriptor +** @param [r] fd [int32] file descriptor ** @param [w] packet [GPS_PPvt_Data *] packet ** ** @return [int32] success ************************************************************************/ -int32_t GPS_A800_Get(gpsdevh** fd, GPS_PPvt_Data* packet) +int32_t GPS_A800_Get(gpsdevh* fd, GPS_PPvt_Data* packet) { GPS_Packet tra; GPS_Packet rec; - if (!GPS_Packet_Read(*fd, &rec)) { + if (!GPS_Packet_Read(fd, &rec)) { return gps_errno; } - if (!GPS_Send_Ack(*fd, &tra, &rec)) { + if (!GPS_Send_Ack(fd, &tra, &rec)) { return gps_errno; } diff --git a/jeeps/gpsapp.h b/jeeps/gpsapp.h index 52d4ee52f..f06289e99 100644 --- a/jeeps/gpsapp.h +++ b/jeeps/gpsapp.h @@ -51,8 +51,8 @@ void GPS_D700_Get(const GPS_Packet& packet, double* lat, double* lon); void GPS_D700_Send(GPS_Packet& packet, double lat, double lon); int32_t GPS_A800_On(const char* port, gpsdevh** fd); -int32_t GPS_A800_Off(const char* port, gpsdevh** fd); -int32_t GPS_A800_Get(gpsdevh** fd, GPS_PPvt_Data* packet); +int32_t GPS_A800_Off(gpsdevh* fd); +int32_t GPS_A800_Get(gpsdevh* fd, GPS_PPvt_Data* packet); void GPS_D800_Get(const GPS_Packet& packet, GPS_PPvt_Data* pvt); int32_t GPS_A906_Get(const char* port, GPS_PLap** lap, pcb_fn cb); diff --git a/jeeps/gpscom.cc b/jeeps/gpscom.cc index f6fe19e07..afa1239f5 100644 --- a/jeeps/gpscom.cc +++ b/jeeps/gpscom.cc @@ -580,13 +580,12 @@ int32_t GPS_Command_Pvt_On(const char* port, gpsdevh** fd) ** ** Instruct GPS to stop sending Pvt data every second ** -** @param [r] port [const char *] serial port -** @param [w] fd [int32 *] file descriptor +** @param [r] fd [int32] file descriptor ** ** @return [int32] success ************************************************************************/ -int32_t GPS_Command_Pvt_Off(const char* port, gpsdevh** fd) +int32_t GPS_Command_Pvt_Off(gpsdevh* fd) { int32_t ret = 0; @@ -597,7 +596,7 @@ int32_t GPS_Command_Pvt_Off(const char* port, gpsdevh** fd) switch (gps_pvt_transfer) { case pA800: - ret = GPS_A800_Off(port,fd); + ret = GPS_A800_Off(fd); break; default: GPS_Error("Pvt_Off: Unknown position protocol"); @@ -613,13 +612,13 @@ int32_t GPS_Command_Pvt_Off(const char* port, gpsdevh** fd) ** ** Get a single PVT info entry ** -** @param [w] fd [int32 *] file descriptor +** @param [r] fd [int32] file descriptor ** @param [w] pvt [GPS_PPvt_Data *] pvt data structure to fill ** ** @return [int32] success ************************************************************************/ -int32_t GPS_Command_Pvt_Get(gpsdevh** fd, GPS_PPvt_Data* pvt) +int32_t GPS_Command_Pvt_Get(gpsdevh* fd, GPS_PPvt_Data* pvt) { int32_t ret = 0; diff --git a/jeeps/gpscom.h b/jeeps/gpscom.h index bb34cb81f..fa1fc0900 100644 --- a/jeeps/gpscom.h +++ b/jeeps/gpscom.h @@ -14,8 +14,8 @@ int32_t GPS_Command_Get_Position(const char* port, double* lat, double* lon); int32_t GPS_Command_Send_Position(const char* port, double lat, double lon); int32_t GPS_Command_Pvt_On(const char* port, gpsdevh** fd); -int32_t GPS_Command_Pvt_Off(const char* port, gpsdevh** fd); -int32_t GPS_Command_Pvt_Get(gpsdevh** fd, GPS_PPvt_Data* pvt); +int32_t GPS_Command_Pvt_Off(gpsdevh* fd); +int32_t GPS_Command_Pvt_Get(gpsdevh* fd, GPS_PPvt_Data* pvt); int32_t GPS_Command_Get_Almanac(const char* port, GPS_PAlmanac** alm); int32_t GPS_Command_Send_Almanac(const char* port, GPS_PAlmanac* alm, int32_t n); -- 2.30.2